//
//  RCDBaseNavigationController.m
//  BaseProject
//
//  Created by 任辰东 on 2018/7/12.
//  Copyright © 2018年 任辰东. All rights reserved.
//

#import "RCDBaseNavigationController.h"

@interface RCDBaseNavigationController ()

@end

@implementation RCDBaseNavigationController

- (void)viewDidLoad
{
    [super viewDidLoad];
        
    self.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:UIColorFromHex(kColorNavBarTitle),
                                               NSFontAttributeName:UIFontSize(kNavBarTitleFont)
    };
    
    [self apperanceSetup];
}

-(void)apperanceSetup {
    
    if(@available(ios  13.0,*)){
        
        UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc]init];
        appearance.backgroundColor = UIColorFromHex(kColorMain);//背//appearance.shadowColor =UIColor.clearColor;//导
        appearance.titleTextAttributes = @{NSForegroundColorAttributeName:UIColorFromHex(kColorNavBarTitle),
                                           NSFontAttributeName:UIFontSize(kNavBarTitleFont)};//导航栏标题颜色
        self.navigationBar.standardAppearance = appearance;
        self.navigationBar.scrollEdgeAppearance = appearance;
        //解决导航栏透明问题self.navigationBar.translucent=NO;self.navigationBar.barTintColor=UIColorFromHex(202,225,248)self.navigationBar.tintColor=UIColorFromHex(0,0,0);
        [self.navigationBar setTitleTextAttributes:@{NSFontAttributeName:UIFontSize(kNavBarTitleFont)}];
    }
    
}

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}

#pragma mark - Orientation
- (BOOL)shouldAutorotate
{
    return self.topViewController.shouldAutorotate;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    return self.topViewController.supportedInterfaceOrientations;
}

-(UIViewController *)childViewControllerForStatusBarStyle
{
    return  self.topViewController;
}

@end
